//
//  SqlValue.cpp
//  Phidgets
//
//  Created by Daniel Hazelbaker on 11/19/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#include "SqlValue.h"


//
// Cleanup any reserved memory used by this object.
//
SqlValue::~SqlValue()
{
    switch (_type)
    {
        case SqlValue_String:
        case SqlValue_Int:
        case SqlValue_Null:
        default:
            break;
    }
}


//
// Bind this value to the SQLite prepared statement at the given
// named parameter index.
//
void SqlValue::bindValue(sqlite3_stmt *statement, int index)
{
    switch (_type)
    {
        case SqlValue_Null:
            sqlite3_bind_null(statement, index);
            break;
            
        case SqlValue_Int:
            sqlite3_bind_int(statement, index, _intValue);
            break;
            
        case SqlValue_String:
            sqlite3_bind_text(statement, index, _stringValue.c_str(), -1, SQLITE_STATIC);
            break;
            
        default:
            break;
    }
}


